using UnityEngine;
using UnityEngine.UI;

namespace Voodoo.Meta.Demo
{
	[RequireComponent(typeof(Demo_LeaderboardTest))]
	public class Demo_RestartLeaderboard : MonoBehaviour
	{
		public int scoreMultiplier = 4;

		public Button restartButton;

		private Leaderboard _leaderboard;

		private Demo_LeaderboardTest _leaderboardTest;

		private void Start()
		{
			_leaderboardTest = GetComponent<Demo_LeaderboardTest>();
			_leaderboard = _leaderboardTest.leaderboard;
		}

		public void RestartWithBonus()
		{
			SetRestartButtonVisibility(isActive: false);
			int currentScore = _leaderboardTest.currentScore;
			int num = _leaderboardTest.currentScore + _leaderboardTest.GainedScore * scoreMultiplier;
			_leaderboardTest.currentScore = num;
			_leaderboard.Restart(currentScore, num);
		}

		public void SetRestartButtonVisibility(bool isActive)
		{
			restartButton.gameObject.SetActive(isActive);
		}
	}
}
